<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>航空公司-添加</title>
    <meta name="keywords" content="">
    <meta name="description" content="">

    <include file="Index/common_css"/>
    <link href="__PUBLIC__/admin/css/plugins/iCheck/custom.css" rel="stylesheet">
    <link rel="stylesheet" type="text/css" href="__PUBLIC__/common/css/Hui-iconfont/1.0.7/iconfont.css"/>
    <style>
        .Validform_checktip{color:red;line-height: 30px;}
    </style>
</head>

<body>
<div class="wrapper wrapper-content animated fadeInRight">
    <div class="row">
        <form action="__URL__/addAeronautical" method="post" class="form form-horizontal" id="form" enctype="multipart/form-data">
            <div class="form-group">
                <label class="col-sm-3 control-label">航空名称：</label>
                <div class="col-sm-8">
                    <input name="name"  class="form-control" type="text"  datatype="*2-30" placeholder="30字以内" nullmsg="null" errormsg="&#xe706;" sucmsg=" ">
                </div>
                <i class="Validform_checktip Hui-iconfont">*</i>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">代码：</label>
                <div class="col-sm-8">
                    <input name="code"  class="form-control" type="text"  datatype="*2-10" placeholder="代码" nullmsg="null" errormsg="&#xe706;" sucmsg=" ">
                </div>
                <i class="Validform_checktip Hui-iconfont">*</i>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">地区：</label>
                <div class="col-sm-8">
                    <input name="address"  class="form-control" type="text"  datatype="*" placeholder="地区" nullmsg="null" errormsg="&#xe706;" sucmsg=" ">
                </div>
                <i class="Validform_checktip Hui-iconfont">*</i>
            </div>
            <div class="form-group">
                <label class="col-sm-3 control-label">状态：</label>
                <div class="col-sm-8">
                    <select name="status" id="type" class="input-sm form-control input-s-sm inline">
                        <option value="1">已上线</option>
                        <option value="2">未上线</option>
                    </select>
                </div>
                <i class="Validform_checktip Hui-iconfont">*</i>
            </div>
            <div class="row cl">
                <div class="col-xs-8 col-sm-9 col-xs-offset-4 col-sm-offset-3">
                    <button type="button" class="btn btn-success radius" id="btn-save">
                        <i class="icon-ok"></i> 保存
                    </button>

                    <a style="margin-left: 20px;" onclick="layerClose()" class="btn btn-success btn-warning">
                        <i class="icon-ok"></i> 返回
                    </a>
                </div>
            </div>
        </form>
    </div>
</div>
<!-- 全局js -->
<include file="Index/common_js"/>
<!-- Peity -->
<!-- 自定义js -->
<script src="__PUBLIC__/admin/js/content.js?v=1.0.0"></script>
<!-- iCheck -->
<script src="__PUBLIC__/admin/js/plugins/iCheck/icheck.min.js"></script>
<!-- Peity -->
<script src="__PUBLIC__/common/layer/layershow.js" type="text/javascript"></script>
<script>
    var index;
    $("#form").Validform({/*入金*/
        btnSubmit:"#btn-save",
        ajaxPost:true,
        tiptype: function(msg, o, cssctl) {
            //msg：提示信息;
            //o:{obj:*,type:*,curform:*}, obj指向的是当前验证的表单元素（或表单对象），type指示提示的状态，值为1、2、3、4， 1：正在检测/提交数据，2：通过验证，3：验证失败，4：提示ignore状态, curform为当前form对象;
            //cssctl:内置的提示信息样式控制函数，该函数需传入两个参数：显示提示信息的对象 和 当前提示的状态（既形参o中的type）;
            if (!o.obj.is("form")) { //验证表单元素时o.obj为该表单元素，全部验证通过提交表单时o.obj为该表单对象;
                var objtip = o.obj.parent().siblings(".Validform_checktip");
                cssctl(objtip, o.type);
                objtip.text(msg);
            }
        },beforeSubmit:function(curform){
            index = layer.load();
        },callback:function(data){
            layer.close(index);
            //alert(JSON.stringify(data));return;
            console.log(data);
            if(data.status==1){
                layer.msg(data.msg,{icon: 1, time: 1000});
                setTimeout(function () {location.reload();},1000);
            }else if(data.status==0){
                layer.msg(data.msg,{icon: 2, time: 2000});
            }else{
                layer.msg('网络错误',{icon: 2, time: 2000});
            }
        }
    });

    function layerClose(){
        layer_close();
    }
</script>
</body>
</html>
